/*
 * CenterMassBW.cpp
 *
 *  Created on: Jan 4, 2015
 *      Author: marchi
 */

#include "CenterMassBW.h"
void CenterMassBW::WriteIt(ostream & fout) const {
	const int nW1=9,nW2=5;
	vector<complex<double> > Wig_1;
	vector<complex<double> > Wig_2;
	for(auto it: Q_t){
		WignerDMatrix Wigner(it);
		for(auto i=-1;i<=1;i++)
			for(auto j=-1;j<=1;j++)
				Wig_1.push_back(Wigner(1,i,j));
		for(auto i=-2;i<=2;i++)
			Wig_2.push_back(Wigner(2,i,0));
	}
	vector<double> t(cm.size()*DIM);
	auto n=0;
	for(auto v: cm)
		for(auto q=0;q<DIM;q++)
			t[n++]=v[q];
	int r=cm.size();
	double time=CenterMass::getTime();
	fout.write((char *) &time, sizeof time);
	fout.write((char *) &r, sizeof r);
	fout.write(reinterpret_cast<const char *> (&CO), sizeof(Matrix));
	fout.write(reinterpret_cast<const char *> (&OC), sizeof(Matrix));
	fout.write((char *) &t[0], (sizeof t[0])*r*DIM);
	fout.write((char *) &Wig_1[0], (sizeof Wig_1[0])*r*nW1);
	fout.write((char *) &Wig_2[0], (sizeof Wig_2[0])*r*nW2);
}
CenterMassBW::CenterMassBW() {
	// TODO Auto-generated constructor stub

}

CenterMassBW::~CenterMassBW() {
	// TODO Auto-generated destructor stub
}

